package com.my.ycv51.ycinit.result;


import android.os.Parcel;
import android.os.Parcelable;

/**
 * The class describes that result  of the decoder decode image.
 *
 * @Author MRH
 */
public class DecodeResult implements Parcelable {


    /**
     * Indicate that error code of the decoding
     */
    private int errorCode;

    /**
     * Indicate that the result of the decoding
     */
    private String result;

    /**
     * Indicate that error message of the decoding
     */
    private String errorMsg;


    public DecodeResult() {
    }


    public DecodeResult(Parcel source) {
        this.errorCode = source.readInt();
        this.errorMsg = source.readString();
        this.result = source.readString();
    }

    public DecodeResult(int errorCode, String result, String errorMsg) {
        this.errorCode = errorCode;
        this.result = result;
        this.errorMsg = errorMsg;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public String toString() {
        return "DecodeResult{" +
                "errorCode=" + errorCode +
                ", result='" + result + '\'' +
                ", errorMsg='" + errorMsg + '\'' +
                '}';
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.errorCode);
        dest.writeString(this.errorMsg);
        dest.writeString(this.result);
    }

    public static final Creator<DecodeResult> CREATOR = new Creator<DecodeResult>() {

        @Override
        public DecodeResult createFromParcel(Parcel source) {
            return new DecodeResult(source);
        }

        @Override
        public DecodeResult[] newArray(int size) {
            return new DecodeResult[size];
        }
    };
}
